<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.wxtf.platform.plugins.user.*"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
	UserBean user = (UserBean)request.getSession().getAttribute("userBean");
	String _db = user.getDbType();	
	   
	    Map<String,List<Map<String, String>>> dicMap = user.getDicMap();
	    List<Map<String, String>> list = null;
	    String temp = "";	
	    String tbe_marital_status = "";//婚姻状态
	    String tbe_nation = "";//民族
	    
	    list = null;
	    list = dicMap.get("27");
	    if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			tbe_marital_status += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	    }
	    list = null;
	    list = dicMap.get("5");
	    if(null != list && list.size() > 0){
		for(Map<String, String> map: list){
			tbe_nation += "<option value=\"" + map.get("tmgd_id")+"\">" + map.get("tmgd_name") + "</option>";
		}
	    }
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="<%=basePath%>"/>
		<title>本月新生儿名单</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta http-equiv="pragma" content="no-cache"/>
		<meta http-equiv="cache-control" content="no-cache"/>
		<meta http-equiv="expires" content="0"/>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

		<link type="text/css" rel="stylesheet" href="ligerUI/skins/Aqua/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/<%=user.getUserCss()%>/css/ligerui-all.css" />
		<link type="text/css" rel="stylesheet" href="ligerUI/skins/ligerui-icons.css" />
		<link type="text/css" rel="stylesheet" href="resource/css/style.css" />

        <style type="text/css">
		
		#baobiao{
			background-color:#EAEEF5;
		}
		#baobiao_table{
			border:1px #222222 solid;
			border-collapse:collapse;
		}
		#baobiao_table td{
			margin:0px;
			padding:0px;
			border:1px #222222 solid;
			font-size:14px;
			text-align:center;
		}
		#baobiao_table thead td{
			color:#3893CC;
			font-weight: bold;
		}
		#baobiao_table tbody td{
			height:27px;
		}
		#baobiao_table tfoot td{
			text-align:left;
			padding-left:5px;
		}
		#col_num_tr td{
			height:40px;
		}
		#baobiao_table #date_td{
			text-align:right;
		}

		#baobiao_table #title_td{
			font-size:18px;
			font-weight:700;
		}
		#baobiao_table .comname_td{
			text-align:left;
			!font-size:12px;
		}
		#baobiao_table .children_td{
			text-align:right;
			font-size:13px;
			padding-right:2px;
		}
		#baobiao_table #month,#day{
			width:30px;
			text-align:right;
		}
		.table_input{
			padding:0px;
			margin:0px;
			width:92%;
			font-size:13px;
			background:none;
			border:1px #EAEEF5 solid;
			text-align:right;
		}
		
		.otr_input{
			font-size:13px;
			font-weight:100;
			background:#EAEEF5;
		}
		
		.detail_link{
			text-decoration:none;
			color:#000000;
		}
		
		.detail_link:hover{
			text-decoration:none;
			color:#4fa8e6;
		}
	    </style>
        
		<script type="text/javascript" src="js/jquery/jquery-1.7.2.js"></script>
		<script type="text/javascript" src="ligerUI/js/core/base.js"></script>
		<script type="text/javascript" src="ligerUI/js/ligerui.min.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
		<script type="text/javascript" src="js/validata.js"></script>

		<script type="text/javascript" src="ligerUI/js/plugins/ligerGrid.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerTree.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerForm.js"></script>
		<script type="text/javascript" src="ligerUI/js/plugins/ligerDateEditor.js"></script>
		
		<script type="text/javascript" src="ligerUI/jquery-validation/jquery.validate.min.js" ></script> 
		<script type="text/javascript" src="ligerUI/jquery-validation/jquery.metadata.js"></script>
		<script type="text/javascript" src="ligerUI/jquery-validation/messages_cn.js" ></script>
		
<script type="text/javascript">
var _db = '<%=_db%>';

_jsonObj.classname = "com.wxtf.platform.main.proprietaryInquires.ChildrenQuery";
_jsonObj.methodname = "";
_jsonObj.logicdata = '';

var manager;
var win;

$(function(){
	manager = $("#emp-grid").ligerGrid({
		url: _url, parms: _jsonObj, width: '100%', height: '100%',
		usePager: true, rownumbers: true, checkbox: false, alternatingRow: true,
		columns: [
			
			{ display: '新生儿登记卡id', name: 'tbenm_id',id:'tbenm_id', hide: true,width:1 },
			{ display: '出生时间', name: 'tbenm_birth_time',id:'tbenm_birth_time',width:100 },
			{ display: '计划状态登记项', name: 'tbenm_plan_status',id:'tbenm_plan_status',width:120,
			  render: function(record, index, value, oth){
			         if(record.tbenm_plan_status =='0')  {return "计划内一胎";}
			         if(record.tbenm_plan_status =='1')  {return "计划内二胎";}
 			      }
			 },
			{ display: '胎数', name: 'tbenm_gravida_num',id:'tbenm_gravida_num',width:100 },
			{ display: '胎次', name: 'tbenm_gravida_times',id:'tbenm_gravida_times',width:1, hide: true },

			{ display: '员工姓名', name: 'tbe_name',id:'tbe_name',width:100 },
			{ display: '员工单位', name: 'reserve1',id:'reserve1',width:150 ,isSort:false},
			{ display: '配偶姓名', name: 'tbfi_spouse_name',id:'tbfi_spouse_name',width:100 },
			{ display: '配偶单位', name: 'tbfi_spouse_department',id:'tbfi_spouse_department',width:150,isSort:false}
			
		]
	});

	
	/*
	 * 日期框
	 */
	$("#ser_from").ligerDateEditor({ format: "yyyy-MM-dd", width:182 });
	$("#ser_to").ligerDateEditor({ format: "yyyy-MM-dd", width:182});
});


/*
 * 表格刷新
 */
function reload(){
	_jsonObj.methodname = "queryPage";
	_jsonObj.logicdata = "[{\"types\":\"init\"}]";
	manager.loadData();
}

/*
 * 重置-条件查询
 */
function serReset(){
	$('#ser_from').val('');
	$('#ser_to').val('');
	$('#ser_plan_status').val('');
	$('#ser_late').val('');
}

/*
 * 条件查询
 */
function serch1(){
	var ser_from = $('#ser_from').val();
	var ser_to = $('#ser_to').val();
    var ser_org = $('#ser_org').val();
    var ser_plan_status = $('#ser_plan_status').val();
    var ser_late = $('#ser_late').val();
	_jsonObj.methodname = "queryPage";
	_jsonObj.logicdata = '[{\"ser_from\":\"' + ser_from	+ '\",\"ser_to\":\"' + ser_to+ '\",\"type\":\"tj_ser\",\"ser_org\":\"'+ ser_org+'\",\"ser_plan_status\":\"'+ ser_plan_status+'\",\"ser_late\":\"'+ ser_late+'\"}]';
	manager.loadData();
}

/*
 * 时间验证
 */
function joinTime(ele){
	var ser_from = $('#ser_from').val();
	var ser_to = $('#ser_to').val();
	if('' != ser_from && '' != ser_to){
		var res = compareDate(ser_from, ser_to);
		if(null == res || res >= 0){
			ele.value = '';
			warningTip('时间有误！');
			return;
		}
	}
}


function huizong(){
	if(win == null){
		win = initWindowByDiv2('emp-div', '今年新生儿人数汇总', 1010, 450, function()            
	 {
		win.hide();
	});
	} else {
		win.show();
	}
	_jsonObj.methodname = "huizong";
	_jsonObj.logicdata = '';
	var _dataTotal = 0;
	    //窗口打开时清除
		var tableObj=document.getElementById("neirong_wz");
		var rowNum=tableObj.rows.length;
		for(var i=rowNum-1;i>=0;i--)
		{
    		tableObj.deleteRow(i);
   		}

				callserver(_jsonObj, function(data, textStatus){
					if(data.Total > 0){
						_dataTotal = data.Total;
						var row;
						var tr;
						for(var i = 0 ; i < data.Total ; i++){
							row = data.Rows[i];
							tr = '<tr><td>' + (i + 1) + '</td>';
							
								tr = tr + '<td class="comname_td">' + row.name1 + '<input type="hidden" id="name1" name="name1" value="' + row.name1 + '"/></td>';
							
							tr = tr + '<td>'+row.name2 +'<input type="hidden" id="' + i + '_name2" name="name2" class="table_input textbg1" value="' + row.name2 + '"/></td>'
								+ '<td>'+row.name3 +'<input type="hidden" id="' + i + '_name3" name="name3" class="table_input textbg1" value="' + row.name3 + '"/></td>'
								+ '<td>'+row.name4 +'<input type="hidden" id="' + i + '_name4" name="name4" class="table_input textbg1" value="' + row.name4 + '"/></td>'
								+ '<td>'+row.name5 +'<input type="hidden" id="' + i + '_name5" name="name5" class="table_input textbg1" value="' + row.name5 + '"/></td>'
								+ '<td>'+row.name6 +'<input type="hidden" id="' + i + '_name6" name="name6" class="table_input textbg1" value="' + row.name6 + '"/></td>'
								+ '<td>'+row.name7 +'<input type="hidden" id="' + i + '_name7" name="name7" class="table_input textbg1" value="' + row.name7 + '"/></td>'
								+ '<td>'+row.name8 +'<input type="hidden" id="' + i + '_name8" name="name8" class="table_input textbg1" value="' + row.name8 + '"/></td>'
								+ '<td>'+row.name9 +'<input type="hidden" id="' + i + '_name9" name="name9" class="table_input textbg1" value="' + row.name9 + '"/></td>'
								+ '<td>'+row.name10 +'<input type="hidden" id="' + i + '_name10" name="name10" class="table_input textbg1" value="' + row.name10 + '"/></td>'
								+ '<td>'+row.name11 +'<input type="hidden" id="' + i + '_name11" name="name11" class="table_input textbg1" value="' + row.name11 + '"/></td>'
								+ '<td>'+row.name12 +'<input type="hidden" id="' + i + '_name12" name="name12" class="table_input textbg1" value="' + row.name12 + '"/></td>'
								+ '<td>'+row.name13 +'<input type="hidden" id="' + i + '_name13" name="name13" class="table_input textbg1" value="' + row.name13 + '"/></td>'
								+ '<td>'+row.name14 +'<input type="hidden" id="' + i + '_name14" name="name14" class="table_input textbg1" value="' + row.name14 + '"/></td>'
							+ '</tr>';
							$("#baobiao_table tbody").append(tr);
							}
							var heji_tr='<tr>'+'<td colspan="14" height="50"><font color="red"><b>总&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;合&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;计</b></font></td>' + '<td><font color="red"><b>'+data.Heji+'<input type="hidden" id="sum_name" name="sum_name" class="table_input textbg1" value="' +  data.Heji + '"/></b></font></td>'+'</tr>'
					$("#baobiao_table tbody").append(heji_tr);
					}
				}, function(data, textStatus){
						warningTip("ERROR!!!");
					});
					
		$("#baobiao_download").click(function(){
					_jsonObj.methodname = "download";
					callserver(_jsonObj, function(data, textStatus){
						if(data.result){
							downloadFile(data.resultrecord);
						} else {
							warningTip(data.resultrecord);
						}
					}, function(data, textStatus){
					    warningTip(data.resultrecord);
					});
				});
}



</script>
</head>
	<body>
        <div tabid="home1" style="height:300px" >
		<table id="aaa" class="serTable">
			<tr>
			<td>机构：</td>
				<td>
					<select id="ser_org" style=" width: 160px;">
						<%=user.getCurSubOrgOptions()%>
					</select>
				</td>
				<td>出生日期：</td>
				<td><input id="ser_from" onChange='joinTime(this);' onkeyup="this.value=formatdata(this.value);"/></td>
				<td>-</td>
				<td><input id="ser_to" onChange='joinTime(this);' onkeyup="this.value=formatdata(this.value);"/></td>
				<td><input class="btn2" value="重置" type="button" onclick="serReset();" /></td>
				<td><input class="btn2" value="人数汇总" type="button" onclick="huizong();" /></td>
			</tr>
			<tr>
			<td>计划状态：</td>
				<td>
					<select id="ser_plan_status" style="width: 160px;">
						<option value=""></option>
						<option value="0">计划内一胎</option>
						<option value="1">计划内二胎</option>
					</select>
				</td>
				<td>晚婚+晚育：</td>
				<td>
					<select id="ser_late" style=" width: 180px;">
						<option value=""></option>
						<option value="wan_all">晚育+晚育</option>
					</select>
				</td>
				<td></td>
				<td></td>
				<td><input class="btn2" value="搜索" type="button" onclick="serch1();" /></td>
				<td></td>
			</tr>
		</table>
		
		<div id="emp-grid"></div>
		</div>
		
		
		<div id="emp-div" style="display: none;">
	    	<form id="baobiao_form" name="baobiao_form">
	    	<table id="baobiao_table" class="table-style">
				<thead>
					<tr><td id="title_td" colspan="15" height="40">今年新生儿人数汇总<br /></td></tr>
					<!--  <tr><td align="right" id="date_td" colspan="15" height="30">2012年<input type="text" id="month" name="month" validate="{required:true,digits:true,maxlength:2}" class="otr_input textbg1"/>月<input type="text" id="day" name="day" size="2" validate="{required:true,digits:true,maxlength:2}" class="otr_input textbg1"/>日</td></tr>-->
					<tr>
						<td rowspan="3" width="25">序<br/><br/>号</td>
						<td rowspan="3" width="90">单&nbsp;&nbsp;位</td>
						<td colspan="12" height="50">月&nbsp;&nbsp;&nbsp;份</td>
						<td rowspan="3" width="35">合<br/><br/>计</td>
					</tr>
					<tr>
					   <td colspan="3" height="50">第一季度</td>
					   <td colspan="3" height="50">第二季度</td>
					   <td colspan="3" height="50">第三季度</td>
					   <td colspan="3" height="50">第四季度</td>
					</tr>
					<tr>
						<td width="35">1月</td>
						<td width="35">2月</td>
						<td width="35">3月</td>
						<td width="35">4月</td>
						<td width="35">5月</td>
						<td width="35">6月</td>
						<td width="35">7月</td>
						<td width="35">8月</td>
						<td width="35">9月</td>
						<td width="35">10月</td>
						<td width="35">11月</td>
						<td width="35">12月</td>
					</tr>
				<!-- <tr id="col_num_tr" ><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td><td>15</td></tr> -->
				</thead>
				<tbody id='neirong_wz'>
				</tbody>
				<tfoot>
					
					
				</tfoot>
			</table>
			</form>
			<br/>
			
			<button id="baobiao_download">下载报表</button>
	    </div>
		
		
		
	</body>
</html>